Ext.onReady(function(){ 

Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'under';

var record_start = 0; 

var sm = new Ext.grid.CheckboxSelectionModel();
var cm=new Ext.grid.ColumnModel([ 
sm,
new Ext.grid.RowNumberer({header: "编号",
width:40, 
renderer:function(value,metadata,record,rowIndex){ 
return record_start + 1 + rowIndex; 
} 
}),
{header:'信用评级生成日期',dataIndex:'currentDate',width:100},
{header:'信用评级',dataIndex:'currentPDLevel',width:100},
{header:'PD',dataIndex:'currentPDValue',width:100},
{header:'评级到期日',dataIndex:'endDate',width:100},
{header:'财报会计月份',dataIndex:'accountMonth',width:100},
{header:'打分卡模板',dataIndex:'model',width:100}, 
{header:'评级状态',dataIndex:'phaseStat',width:100},
{header:'风险暴露分类',dataIndex:'exposureType',width:100},
{header:'初评人',dataIndex:'firstUserId',width:100}
]); 

var ds = new Ext.data.Store({ 
proxy:new Ext.data.HttpProxy({
url:'customer/listCustomer.do',
method:'POST'
}), 
reader:new Ext.data.JsonReader({ 
totalProperty:'total',  
root:'customer'},[
{name:'custId'}, 
{name:'custName'},  
{name:'industryType'}
]) 
}); 
ds.load({params:{start:0,limit:20}}); 


var grid=new Ext.grid.GridPanel({ 
id:'list',
renderTo:"list", 
stripeRows:true,//斑马线效果
title:"我的对公客户列表", 
height:500, 
cm:cm,
store: ds, 
loadMask: { msg: "加载中..." }, 
viewConfig: {   
                            forceFit:true   
            },   
            bbar: new Ext.PagingToolbar({   
                pageSize: 20,   
                store: ds,
                displayInfo: true,   
                displayMsg: '第{0} 到 {1} 条数据 共{2}条',   
                emptyMsg: "没有数据" ,
                doLoad : function(start){ 
   record_start = start; 
var o = {}, pn = this.getParams(); 
          o[pn.start] = start; 
          o[pn.limit] = this.pageSize; 
this.store.load({params:o}); 
     }   
            }),
 tbar: [
 {text:'发起评级'},
 '-',
 {text:'评级详情'},
 ]              
});


function rowdblclickFn(grid, rowIndex, e){//双击事件  
             var row = grid.getStore().getAt(rowIndex); 
             var selectedCustId = row.get("custId");
             Ext.Ajax.request({
  url:'checkRequest.do',
  method:'GET',
  success:function(){
  window.location.href="obligation/showDebtList.do?CustId="+selectedCustId;
  },failure:function(){
    Ext.MessageBox.alert("请求异常！");
  }
});  
}   
grid.addListener('rowdblclick',rowdblclickFn);
}); 